package cn.highedu.spring.v1;

/**
 * 基于单例模式
 */
public class Factory {
    private static A a;
    private Factory(){}

    public static A getAForB() {
        if (a == null) {
            a = new B();
        }
        return a;
    }
    public static A getAForC() {
        if (a == null) {
            a = new C();
        }
        return a;
    }
}
